package com.fan.shop.mock;

import java.util.Date;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.fan.shop.domain.User;
import com.fan.shop.hibernate.utils.HibernateUtil;

public class UsersMock {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Session session =  HibernateUtil.getSessionFactory().openSession();
		Transaction transaction = session.beginTransaction();
		
		String username = "user";
		for(int i = 0; i < 100; i++)
		{
			
			User user = new User();
			user.setUsername(username + i);
			user.setPassword(username+ i);
			user.setAddress(username + i);
			user.setEmail(username + i + "@" + username + ".com");
			user.setAddress("Address " + username + i);
			user.setPostAddress("Post Address " + username + i);
			user.setPhone(username + i);
			user.setMobile(username + i);
			user.setRegisteredTime(new Date(System.currentTimeMillis()));
			
			session.save(user);
		}
		transaction.commit();
		session.close();
	}

}
